cmake_minimum_required(VERSION 3.3 FATAL_ERROR)

project(TestScalarBar)

#set(VTK_DIR "/Users/dai/Qt/5.15.2/clang_64/lib/cmake/Qt5/lib/cmake/vtk-9.0")
set(VTK_DIR "/Users/dai/Work/vtk/VTK/VTK_MAKE_910/build/lib/cmake/vtk-9.0")


find_package(VTK COMPONENTS

        vtkChartsCore
        vtkCommonColor
        vtkCommonCore
        vtkCommonDataModel
        vtkCommonTransforms
        vtkFiltersCore
        vtkFiltersGeneral
        vtkFiltersModeling
        vtkFiltersSources
        vtkInteractionStyle
        vtkInteractionWidgets
        vtkRenderingAnnotation
        vtkRenderingContextOpenGL2
        vtkRenderingCore
        vtkRenderingFreeType
        vtkRenderingGL2PSOpenGL2
        vtkRenderingOpenGL2
        vtkViewsInfovis
        vtkViewsContext2D
        vtkRenderingContext2D
        vtkIOInfovis
        vtkTestingRendering
        vtkRenderingLOD
        vtkIOGeometry
        vtkIOLegacy
        vtkIOPLY
        vtkIOXML
        vtkFiltersSources
        vtkIOParallel

        vtkFiltersFlowPaths
        vtkFiltersGeometry

        QUIET
        )

if (NOT VTK_FOUND)
    message("Skipping TestScalarBar: ${VTK_NOT_FOUND_MESSAGE}")
    return ()
endif()
message (STATUS "VTK_VERSION: ${VTK_VERSION}")
if (VTK_VERSION VERSION_LESS "8.90.0")
    # old system
    include(${VTK_USE_FILE})
    add_executable(TestScalarBar MACOSX_BUNDLE TestScalarBar.cxx)
    target_link_libraries(TestScalarBar PRIVATE ${VTK_LIBRARIES})
else ()
    # include all components
    add_executable(TestScalarBar MACOSX_BUNDLE TestScalarBar.cxx)
    target_link_libraries(TestScalarBar PRIVATE ${VTK_LIBRARIES})
    # vtk_module_autoinit is needed
    vtk_module_autoinit(
            TARGETS TestScalarBar
            MODULES ${VTK_LIBRARIES}
    )
endif ()